<template>
	<view class="test-box">
		<web-view :src="url" class="web-view" @message="getMessage"></web-view>
	</view>
</template>

<script>
import {bimUrl} from '@/common/urlConfig.js'
	
export default {
	data() {
		return {
			marks: [],
			url:""
		};
	},
	onLoad(params) {
		this.url = `${bimUrl}/outer/photoViewer?token=${params.token}&projectId=${params.projectId}`
		if (params.qrCode) {
			this.url = `${this.url}&qrCode=${params.qrCode}`
		}
		setTimeout(() => {
			uni.setNavigationBarTitle({
				title: '全景取样位置定位'
			});
		}, 200);
	},
	methods: {
		getMessage(e) {
			this.marks = e.detail.data[0].marks ? e.detail.data[0].marks : [];
		},
		/* 按钮 */
		onNavigationBarButtonTap(e) {
			//如果有数据
			if (this.marks) {
				let pages = getCurrentPages();
				let prevPage = pages[pages.length - 2]; //上一个页面
				let data = {
					x: this.marks[0].longitude,
					y: this.marks[0].latitude
				}
				prevPage.$vm.getOverallView(data);
				uni.navigateBack();
			}
		}
	}
};
</script>

<style>
.test-box {
	width: 100vw;
	height: 100vh;
}
.web-view {
	width: 100vw;
	height: 100vh;
}
</style>
